<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>注册</title>
    <link rel="stylesheet" type="" href="./style/register.css">
    <script src="./js/jquery-3.2.1.js"></script>
</head>

<body>
    <header class="zc_head">
        <div class="contain">
            <div class="zc_content">
                <div class="zc_head_zuo">
                    <div class="zc_jddog one_one">
                    </div>
                    <span>欢迎注册</span>
                </div>
                <div class="zc_head_you">
                    <span class="font-gray">已有账号?</span>
                    <a href="./login.html">请登录</a>
                </div>
            </div>
        </div>
    </header>
    <div class="contain tanxing">
        <div class="zc_left">
            <form class="relative" action="/api/v1/user/register" method="post">
                <div>
                    <label for="name">用户名</label>
                    <input type="text" name="petname" placeholder="您的账户名和登录名">
                </div>
                <div>
                    <label for="psw">设置密码</label>
                    <input type="password" name="password" placeholder="建议至少使用两种字符组合">
                </div>
                <div>
                    <label for="repsw">确认密码</label>
                    <input type="password" name="repsw" placeholder="请再次输入密码">
                </div>
                <div>
                    <label for="phone" id="haoma">中国&#x3000;0086</label>
                    <input type="text" name="phone" placeholder="建议使用常用手机">
                </div>
                <a href="">邮箱验证</a>
                <div>
                    <label for="number">验证码</label>
                    <input type="text" name="number" placeholder="请输入验证码">
                    <div class="yanzhengma">   </div>
                </div>
                <div>
                    <label for="number">验证码</label>
                    <input type="text" name="number" placeholder="请输入验证码">
                    <div class="yanzhengma">   </div>
                </div>
                <div>
                    <div id="dl_go"><input type="submit" value="立即登录"></div>
                </div>
            </form>
        </div>
        <div class="zc_right">
            <div>
                <div class="qiye zc_jddog"></div>
                <a class="yihang">企业用户注册</a>
            </div>
            <hr>
            <div>
                <div class="international zc_jddog"></div>
                <a class="lianghang">INTERNATIONAL CUSTOMERS</a>
            </div>
        </div>
    </div>
    <div class="dibu">
        <p>关于我们&#x3000;|&#x3000;联系我们&#x3000;|&#x3000;人才招聘&#x3000;|&#x3000;商家入驻&#x3000;|&#x3000;广告服务&#x3000;|&#x3000;手机京东&#x3000;|&#x3000;友情链接&#x3000;|&#x3000;销售联盟&#x3000;|&#x3000;京东社区&#x3000;|&#x3000;京东公益&#x3000;|&#x3000;English&nbsp;Site</p>
        <p>Copyright&nbsp;©&nbsp;2004-2017&nbsp;&nbsp;京东JD.com&nbsp;&nbsp;版权所有 </p>
    </div>

    <script>
        $('form').submit(function (e) {
            e.preventDefault();
            
            var password = $(':password').map(function () {
                return $(this).val();
            })

            if (password[0] == password[1]) {
                $.post(this.action, $(this).serialize(), (data) => {
                    alert("哈哈哈哈");
                    alert(data.message);
                    if (data.code == "success") {
                        location.href = '/login.html';
                    }
                })
            } else {
                alert('两次密码输入不一致，请重新输入!');
            }
        })
    </script>
</body>

</html>